﻿@*@model VehicleManagement.Models.FinanManInfo
*@

@model IEnumerable<VehicleManagement.Models.FinanManInfo>
           

@{
    ViewBag.Title = "FinanManInfoIndex";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script src="@Url.Content("~/Scripts/SetPagingScript.js")" type="text/javascript"></script>
<script src="../../Scripts/deleteFunction.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        if ($.query.get("Page") != "") {
            $("#Page").val($.query.get("Page"));
        }
        else {
            $("#Page").val(1);
        }

        if ($.query.get("FinanMan_name") != "" && !$.query.get("FinanMan_name")) {
            $("input[name='FinanMan_name']").val($.query.get("FinanMan_name"));
        }

        if ($.query.get("Sex") != "" && !$.query.get("Sex")) {
            $("input[name='Sex']").val($.query.get("Sex"));
        }

        if ($.query.get("Telephone") != "" && !$.query.get("Telephone")) {
            $("input[name='Telephone']").val($.query.get("Telephone"));
        }

        $.get("/FinanManInfo/GetPagingInfo",
            {
                FinanMan_name: $("input[name='FinanMan_name']").val(),
                Sex: $("input[name='Sex']").val(),
                Telephone: $("input[name='Telephone']").val(),
                Page: $("#Page").val()
            },
            function (data) {
                $("#TotalItems").text(data.TotalItems);
                $("#ItemsPerPage").text(data.ItemsPerPage);
                $("#TotalPages").text(data.TotalPages);
                $("#CurrentPage").text($("#Page").val());
            }
        );
        SetPagingOperation();
    });
function DeleteFinanMan(id) {
    if (confirm("你确认删除这条财务人员吗?")) {
        $.post("/FinanManInfo/DeleteFinanMan", "id=" + id, function (ret) {
            if (ret.Result == "true") {
                alert(ret.Message);
                window.location.reload();
            }
            else {
                alert(ret.Message);
            }
        }, "json");
    }
}
</script>
<h2>FinanManInfoIndex</h2>
<h2>添加财务人员</h2>

<p>
    @Html.ActionLink("添加财务人员", "Create")
</p>

           <div >
                <div >
                    条件筛选：
                </div>
                @using (Html.BeginForm("Index", "FinanManInfo", FormMethod.Get, new { id = "SearchForm" }))
                {
                    @Html.Hidden("Page");
                    <div >

                        <input id="key1" name="FinanMan_name" type="text" value="姓名"  />
                    </div>
                    <div >          
                      @*  <input id="key4" name="Sex" type="text" value="性别"  />*@
                                  <select name="Sex">
                            <option selected="selected" >性别</option>
                            <option>男</option>
                            <option>女</option>
                        </select>
                    </div>
                      <div >          
                        <input id="key5" name="Telephone" type="text" value="电话"  />
                    </div>
                     <div >
                        <input  name="key" type="text" value="模糊查找" /><input  type="submit" value="点击查询"  />
                    </div>
  
                }
                <div class="clear">
                </div>
            </div>

<table>
    <tr>
        <th>
            FinanManName
        </th>
        <th>
            FinanManImage
        </th>
        <th>
            Email
        </th>
        <th>
            Sex
        </th>
        <th>
            Telephone
        </th>
        
        <th></th>
    </tr>

@foreach (var item in Model)
{
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.FinanManName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.FinanManImage)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Email)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Sex)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Telephone)
        </td>
       
        <td>
            @Html.ActionLink("编辑", "Edit", new { id = item.FinanManID }) |
            @Html.ActionLink("详细", "Details", new { id = item.FinanManID }) |
               <a href="javascript:void(0)" onclick="DeleteFinanMan(@item.FinanManID)">删除</a>
        </td>
    </tr>
}

</table>
<div>
    共<span id="TotalItems"></span>条记录， 每页显示<span id="ItemsPerPage"></span>条， 共<span id="TotalPages"></span>页，
    当前第<span id="CurrentPage"></span>页 <a id="FirstPage" href="javascript:void(0)">首页</a>
    <a id="PrevPage" href="javascript:void(0)">上一页</a> <a id="NextPage" href="javascript:void(0)">
        下一页</a> <a id="LastPage" href="javascript:void(0)">末页</a> <span>跳转到</span>
    <input type="text" id="PageToGo" />
    <input type="button" id="GoToPage" value="Go" />
</div>